import "package:flutter/material.dart";
import 'package:login_demo/app_theme.dart';
// desc: text input widget
class TextInput extends StatefulWidget {
  TextInput({
    Key key,
    this.icon,
    this.textEditingController,
    this.hintText,
    this.fillColor:false
  }) : super(key: key);
  Widget icon;
  TextEditingController textEditingController;
  String hintText;
  bool fillColor;

  @override
  _TextInputState createState() => _TextInputState();
}

class _TextInputState extends State<TextInput> {
  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: widget.fillColor != true ? BoxDecoration(
        border: Border(
          bottom: BorderSide(width: 1, color: AppTheme.hintGrey)
        )
      ) : null,
      child: Row(
        children: [
          SizedBox(
            child: widget.icon,
          ),
          widget.icon != null ? SizedBox(width: 10) : SizedBox(),
          Expanded(
              child: TextField(
                controller: widget.textEditingController,
                cursorColor: AppTheme.main,
                decoration: InputDecoration(
                  border: InputBorder.none,
                  hintText: widget.hintText,
                  hintStyle: TextStyle(color: AppTheme.hintGrey),
                  isDense: true,
                  contentPadding: EdgeInsets.only(top: 5, bottom: 10, left: 10, right: 10),
                  fillColor: Colors.white,
                  filled: widget.fillColor,
                  // fillColor: Colors.amber
                ),
              )
          )
        ],
      ),
    );
  }
}